<?php
    include 'mysqlconnect.php';
    $params = array(
        'hostname' => '127.0.0.1',
        'dbname' => 'level',
        'username' => 'root',
        'password' => ''
    );
    $connect = new mysqlconnect($params);
    $connect->connect();
    $cases = $connect->fetch('SELECT * FROM cases');
    for($i=0;$i<count($cases);$i++)
    {
        $case_images = $connect->fetch('SELECT filename FROM case_image WHERE case_id=?',$cases[$i]['id']);
        $cases[$i]['case_image'] = $case_images;
    }
    echo json_encode($cases);

?>
